﻿using UnityEngine;


public class SkillNormalAttackLogic:SkillLogicBase
{
    protected override void InitTimeLine()
    {
        _timeLine.AddEvent(0, 0, onSkillStart);//技能开始
        _timeLine.AddEvent(0f, 20, onAction);//播放动画
        _timeLine.AddEvent(1f, 0, onNormalHit);//直接进行伤害结算
        _timeLine.AddEvent(2.1f, 20, onActionEnd);//停止动画
        _timeLine.AddEvent(2.1f, 0, onSkillEnd);//技能结束
    }

    private void onNormalHit(int obj)
    {
        if (_target == null)
        {
            Debug.LogError("普通攻击未找到目标");
            return;
        }
        OnHitSomething();
    }

    private void OnHitSomething()
    {
        //Debug.Log("普攻伤害" + _target.Name);
        DamageMgr.GetInstance().Damage(_caster,_target);
    }
}
